package com.yonyou.crm.bpub.topbar.service;

import java.util.*;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.yonyou.crm.bpub.topbar.entity.*;

@Service
public class TopbarBizServiceImpl {
	
	@Autowired
	CustomerTopbar customerService;
	
	@Autowired
	OpportunityTopbar opportunityService;
	
	@Autowired
	ProductTopbar productService;
	
	@Autowired
	ContactTopbar contactService;
	
	@Autowired
	LeadTopbar leadService;
	
	@Autowired
	DynamicTopbar dynamicService;
	
	public TopbarVO getTopbar(String module){
		TopbarVO topbar = new TopbarVO();
		BaseTopbar service = null;
		switch(module) {
			case "accounts":
				service = customerService;
				break;
			case "opportunities":
				service = opportunityService;
				break;
			case "products":
				service = productService;
				break;
			case "contacts":
				service = contactService;
				break;
			case "leads":
				service = leadService;
				break;
			case "dynamics":
				service = dynamicService;
				break;
			default:
				//nothing
		}
//		service.getEnumListFromDoc(id, name);
		PlanVO presetOptions = service.getPresetOptions();
		topbar.setPresetOptions(presetOptions);
		
		String searchText = service.getSearchPlaceholder();
		topbar.setSearchPlaceholder(searchText);
		
		PlanVO sortData = service.getSortData();
		topbar.setSortData(sortData);
		
		List<SelectDataVO> selectData = service.getSelectData();
		topbar.setSelectData(selectData);
		
		return topbar;
	}
	
	
}
